<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        这是第 {{ msg }} 次点我
        <input type="button" v-on:click="btnClick()" value="呱呱呱">
        <a v-bind:[parmAttribute]="url">呱唧链接</a>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
    <script>
        let app = new Vue({
            el: '#app',
            data(){
                return {
                    url: '#',
                    msg:0,
                    parmattribute: 'href',
                    parmArr: ['fish', 'href', 'pig', 'ant', 'pink', 'blue'],
                    urlArr:[
                        'https://www.baidu.com',
                        'https://www.gitee.com',
                        'https://www.bachelorofspirit.xyz',
                        'https://www.csdn.net',
                        '#'
                    ]
                }
            },
            methods:{
                btnClick: function(){
                    let rnd = Math.floor(Math.random() * this.parmArr.length);
                    let urlrnd = Math.floor(Math.random() * this.urlArr.length)
                    console.log(rnd);
                    console.log(this.url);
                    this.msg = this.msg+=1;
                    this.url = this.urlArr[urlrnd]
                    this.parmattribute = this.parmArr[rnd]
                }
            }
        })
    </script>
</body>
</html>